package uk.ac.aber.Blockmation.old;

//~--- JDK imports ------------------------------------------------------------

import uk.ac.aber.Blockmation.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;

public class LeftPanel2 extends JPanel {
    private JButton   backgroundColourButton;
    private JLabel    blockSizeLabel;
    private JSpinner  blockSizeSpinner;
    private JButton   brushColourButton;
    private JLabel    chooseColourForLabel;
    private MainFrame mainFrame;    // ?
    private JButton   ovalShapeButton;
    private JButton   rectangleShapeButton;
    private JLabel    shapesLabel;
    private JLabel    spinnerLabel;
    private JButton   straightLineButton;

    public LeftPanel2(MainFrame mainFrame) {
        this.mainFrame         = mainFrame;
        shapesLabel            = new JLabel("Shapes");
        chooseColourForLabel   = new JLabel("Colour Options");
        blockSizeLabel         = new JLabel("Block Size");
        spinnerLabel           = new JLabel("Spinner");
        ovalShapeButton        = new JButton("1");
        rectangleShapeButton   = new JButton("2");
        straightLineButton     = new JButton("3");
        backgroundColourButton = new JButton(" Scene");
        brushColourButton      = new JButton(" Brush ");

//      /set size of buttons
        ovalShapeButton.setMaximumSize(new Dimension(30, 30));         // /w,l
        rectangleShapeButton.setMaximumSize(new Dimension(30, 30));    // /w,l
        straightLineButton.setMaximumSize(new Dimension(30, 30));      // /w,l
        ovalShapeButton.setToolTipText("This button allows you to draw with ovals.");
        rectangleShapeButton.setToolTipText("This button allows you to draw with rectangles.");
        straightLineButton.setToolTipText("This button allows you to draw with Lines.");
        backgroundColourButton.setToolTipText("This buttons will change the colour of the background");
        brushColourButton.setToolTipText("This buttons will change the colour of the brush");

//      //buttonname1 = new JButton("buttontext", name of image);
//      /ImageIcon leftButtonIcon = createImageIcon("images/right.gif");

/*
        * Builds a spinner for setting block size.
*/
        int                initial               = mainFrame.getPad().getBlockSize().width;
        SpinnerNumberModel blockSizeSpinnerModel = new SpinnerNumberModel(initial,

//      initial value
        1,      // minimal value
        150,    // maximal value
        1);     // step

        blockSizeSpinner = new JSpinner(blockSizeSpinnerModel);

//      /this.setBackground(Color.red);
        this.setBorder(BorderFactory.createRaisedBevelBorder());

//      ///label for shapes
        JPanel toolbox = new JPanel();

        toolbox.setLayout(new BoxLayout(toolbox, BoxLayout.Y_AXIS));
        toolbox.add(Box.createRigidArea(new Dimension(0, 10)));
        toolbox.add(shapesLabel);
        toolbox.add(Box.createRigidArea(new Dimension(0, 10)));
        toolbox.add(ovalShapeButton);
        toolbox.add(Box.createRigidArea(new Dimension(0, 5)));
        toolbox.add(rectangleShapeButton);
        toolbox.add(Box.createRigidArea(new Dimension(0, 5)));
        toolbox.add(straightLineButton);
        this.add(toolbox);

//      /////// layout the colour buttons
        JPanel toolbox3 = new JPanel();

        toolbox3.setAlignmentY(toolbox3.CENTER_ALIGNMENT);
        toolbox3.setLayout(new BoxLayout(toolbox3, BoxLayout.Y_AXIS));
        toolbox3.add(Box.createRigidArea(new Dimension(0, 70)));
        toolbox3.add(chooseColourForLabel);
        toolbox3.add(Box.createRigidArea(new Dimension(0, 10)));
        toolbox3.add(backgroundColourButton);
        toolbox3.add(Box.createRigidArea(new Dimension(0, 5)));
        toolbox3.add(brushColourButton);
        toolbox3.add(Box.createRigidArea(new Dimension(0, 5)));
        this.add(toolbox3);
        this.setVisible(true);

//      /////// layout the spinner bits
        JPanel toolbox4 = new JPanel();

        toolbox4.setAlignmentY(toolbox4.LEFT_ALIGNMENT);
        toolbox4.setLayout(new BoxLayout(toolbox4, BoxLayout.Y_AXIS));

//      /spinner
        toolbox4.add(Box.createRigidArea(new Dimension(0, 70)));
        toolbox4.add(spinnerLabel);
        toolbox4.add(Box.createRigidArea(new Dimension(0, 10)));
        toolbox4.add(blockSizeSpinner);
        this.add(toolbox4);
        this.setVisible(true);
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
